import React from 'react';
import { Switch, Route, Redirect } from 'react-router-dom';
import PrimaryHeader from '../components/common/NavHeader';
import AppHomePage from '../pages/indexPage/AppHomePage';
import SubredditLayout from './subreddit/AppLayout';
import CounterLayout from './counter/CounterLayout';

// Sub Layouts

const PrimaryLayout = ({ match }) => (
    <div className="container">
        <PrimaryHeader />
        <main>
            <Switch>
                <Route path="/" exact component={ AppHomePage } />
                <Route path="/subreddit" exact component={ SubredditLayout } />
                <Route path="/counter" exact component={ CounterLayout } />
                <Redirect to="/"/>
            </Switch>
        </main>
    </div>
);

export default PrimaryLayout